package com.qiche.service.impl;

import com.qiche.model.Wallet;
import com.qiche.service.WalletService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * Created by Linzw on 2018/01/24.
 */
@Service("walletService")
public class WalletServiceImpl extends BaseService<Wallet> implements WalletService {

	@Override
	public Wallet selectByMerchantId(Long merchanId) {
		Example example=new Example(Wallet.class);
		Example.Criteria criteria=example.createCriteria();
		criteria.andEqualTo("merchantId",merchanId);
		List<Wallet> wallets=mapper.selectByExample(example);
		if(!wallets.isEmpty()){
			return  wallets.get(0);
		}
		return  null;
	}
}
